<%-- 
    Document   : CustomerQL
    Created on : Nov 20, 2012, 10:14:10 PM
    Author     : PhuongND
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" import="java.sql.*"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>
           Admin manager Admin number
        </title>
<!--        <LINK href="/css/index_style.css" rel=stylesheet>-->
        <META http-equiv=Content-Type
              content="text/html; charset=UTF-8">
         <link href="css/index_style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <%
            if (session.getValue("username") == null) {
                response.sendRedirect("admin.jsp");
            }
        %>
        <script language="JavaScript">
            function checkInputAddCus(){
                if((document.FormAddCus.id.value=="") || (document.FormAddCus.username.value=="") || (document.FormAddCus.password.value=="") || (document.FormAddCus.email.value=="") || (document.FormAddCus.name.value=="") || (document.FormAddCus.address.value=="") || (document.FormAddCus.iden_num.value=="") || (document.FormAddCus.bank_code.value=="")){
                    alert("Nhap thieu thong tin.");
                    document.FormAddCus.id.focus();
                    return false;
                }
                return true;
            }
        </script>
        <script language="JavaScript">
            function checkInputEditCus(){
                if((document.FormEditCus.id.value=="") || (document.FormEditCus.username.value=="") || (document.FormEditCus.password.value=="") || (document.FormEditCus.email.value=="") || (document.FormEditCus.name.value=="") || (document.FormEditCus.address.value=="") || (document.FormEditCus.iden_num.value=="") || (document.FormEditCus.bank_code.value=="")){
                    alert("Nhap thieu thong tin.");
                    document.FormAddCus.id.focus();
                    return false;
                }                
                return true;
            }
        </script>
        
        <div id="baby_wrapper_outter">

            <div id="baby_wrapper_inner">
                <jsp:include page="headerAdmin.jsp"/>
                <div id="baby_content_wrapper">
                    <jsp:include page="menuLeftAdmin.jsp"/>
                    
                    <div id="baby_content">
                           
                        <div class="content_section">
                            <p>Manager Customer________________</p>                            
                          <!-- Access memory-->
                          <c:if test="${requestScope.listCus==null}">
                                <c:redirect url="getCustom"/>
                          </c:if>
    
                          <table class="table" align="center" >
                            <tr>
 <th>ID</th><th>UserName</th><th>PassWord</th><th>Email</th><th>Name</th><th>Address</th><th>Phone</th><th>Bank Code</th><th>Update</th><th>Delete</th>
                            </tr>
                            <tr>
                                <form action="AddCustom" method="post" name="FormAddCus" onSubmit="return checkInputAddCus();">                            
                                    <td><input type="text"  name="id" value="" size="1"></td>
                                    <td><input type="text"  name="username" value="" size="4"></td>
                                    <td><input type="text"  name="password" value="" size="5"></td>
                                    <td><input type="text"  name="email" value="" size="17"></td>
                                    <td><input type="text"  name="name" value="" size="8"></td>
                                    <td><input type="text"  name="address" value="" size="8"></td>
                                    <td><input type="text"  name="iden_num" value="" size="6"></td>
                                    <td><input type="text"  name="bank_code" value="" size="7"></td>
                                    <td><input type="submit" name="bt" value="Add"></td>
                                </form>
                            </tr>
                            
                            <c:forEach items="${requestScope.listCus}" var="ad">  
                                <c:if test="${ad.id!=param.idsua}">
                                    <tr>                                          
                                        <td width="20px" height="50" align="center">
                                             ${ad.id}                                            
                                        </td>
                                        <td  width="60px" height="50" align="center" >
                                             ${ad.userName}        
                                        </td>
                                        <td  width="60px" height="50" align="center" >
                                             ${ad.password}         
                                        </td>
                                        <td  width="150px" height="50" align="center" >
                                             ${ad.email}         
                                        </td>
                                        <td  width="80px" height="50" align="center" >
                                             ${ad.name}         
                                        </td>
                                        <td  width="80px" height="50" align="center" >
                                             ${ad.address}         
                                        </td>
                                        <td  width="80px" height="50" align="center" >
                                             ${ad.iden_num}         
                                        </td>
                                        <td  width="150" height="50" align="center" >
                                             ${ad.bank_code}         
                                        </td>
                                          
                                        <td  width="150" height="50" align="center">
                                            <a href="getCustom?idsua=${ad.id}" style=" color: #660033">Update</a>        
                                        </td>                                          
                                        <td  width="150" height="50" align="center">
                                            <a href="DelCustom?id=${ad.id}" style=" color: #660033">Delete</a>        
                                        </td>                                          
                                      </tr>                                      
                                </c:if>
                                      
                                <c:if test="${ad.id==param.idsua}">                                          
                                    <tr>
                                        <form action="EditCustom" method="post" name="FormEditCus" onSubmit="return checkInputEditCus();">
                                            <td><input name="idsua" value="${ad.id}" size="1" readonly /></td>
                                            <td><input name="username" value="${ad.userName}" size="4" /></td>
                                            <td><input name="password" value="${ad.password}" size="5" /></td>
                                            <td><input name="email" value="${ad.email}" size="17" /></td>
                                            <td><input name="name" value="${ad.name}" size="8" /></td>
                                            <td><input name="address" value="${ad.address}" size="8" /></td>
                                            <td><input name="iden_num" value="${ad.iden_num}" size="6" /></td>
                                            <td><input name="bank_code" value="${ad.bank_code}" size="7" /></td>

                                            <td><input type="submit" name="btEdit" value="OK"/></td>
                                            <td><a href="DelCustom?id=${ad.id}" style=" color: #660033">Delete</a></td>                                            
                                        </form>
                                    </tr>
                                </c:if>                                         
                            </c:forEach>
                        </table>
                        </div>
                    </div>

                    <div class="cleaner"></div>

                </div> <!-- end of baby_content_wrapper -->

            </div> <!-- end of baby_wrapper_inner -->
        </div> <!-- end of baby_wrapper_outter -->
        <jsp:include page="footerAdmin.jsp"/>
    </body>
</html>
   
      
